Skip to content

MkIFrame

:fa-brands-github: Show source on GitHub

Node for embedding an IFrame.

Example: With caption

Jinja

{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}

Python

MkIFrame('https://phil65.github.io/mknodes/', width=600, height=800)

<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>
<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>

Bases: MkTemplate

__init__

__init__(url: str, *, width: int = 300, height: int = 150, **kwargs: Any) -> None

Parameters:

Name Type Description Default
url str

Url to display in a frame

required
width int

width of frame in pixels

300
height int

height of frame in pixels

150
kwargs Any

Keyword arguments passed to parent

{}
graph TD
  3066175229["mkiframe.MkIFrame"]
  1289759389["mktemplate.MkTemplate"]
  3160803176["rendercache.TemplateRenderMixin"]
  2751680898["builtins.object"]
  835538629["mkcontainer.MkContainer"]
  1956333208["mkcontainer.MkContainerBase"]
  1359323199["mknode.MkNode"]
  1289759389 --> 3066175229
  3160803176 --> 1289759389
  2751680898 --> 3160803176
  835538629 --> 1289759389
  1956333208 --> 835538629
  1359323199 --> 1956333208
  2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mkiframe/metadata.toml
[metadata]
icon = "mdi:web-box"
name = "MkIFrame"

[examples.with_caption]
title = "With caption"
jinja = """
{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}
"""

[output.html]
template = """
<iframe width="{{ node.width }}" height="{{ node.height }}" src="{{ node.url }}"></iframe>
"""
mknodes.basenodes.mkiframe.MkIFrame
class MkIFrame(mktemplate.MkTemplate):
    """Node for embedding an IFrame."""

    ICON = "material/web-box"

    def __init__(
        self,
        url: str,
        *,
        width: int = 300,
        height: int = 150,
        **kwargs: Any,
    ) -> None:
        """Constructor.

        Args:
            url: Url to display in a frame
            width: width of frame in pixels
            height: height of frame in pixels
            kwargs: Keyword arguments passed to parent
        """
        super().__init__("output/html/template", **kwargs)
        self.url = url
        self.width = width
        self.height = height
Page info
Code for this page
mknodes.manual.nodes_section.create_section_for_nodes
def create_section_for_nodes(
    nav: mk.MkNav,
    klasses: Sequence[type[mk.MkNode]],
) -> mk.MkTable:
    table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
    for kls in klasses:
        tpl = "classpage_custom.jinja"
        page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
        nav += page
        if kls.STATUS:
            page.metadata.status = kls.STATUS
        elif kls.JS_FILES:
            page.metadata.status = "js"
        elif kls.CSS:
            page.metadata.status = "css"
        page.created_by = create_section_for_nodes
        link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
        extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
        table.add_row((link, kls.__doc__, extensions))
    return table
Resources
Resources(css=[],
          markdown_extensions={'admonition': {},
                               'pymdownx.details': {},
                               'pymdownx.highlight': {'anchor_linenums': True,
                                                      'line_spans': '__span',
                                                      'pygments_lang_class': True},
                               'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
                                                                           'format': <function fence_code_format at 0x785e0f644250>,
                                                                           'name': 'mermaid'}]},
                               'pymdownx.tabbed': {},
                               'tables': {}},
          plugins=[Plugin('mkdocstrings')],
          js=[],
          assets=[],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
  source_function: create_section_for_nodes
  source_line_no: 93
hide:
- toc
icon: material/web-box
status: new
title: MkIFrame